#include <iostream>
#include "location.h"
#include "party.h"

using namespace std;

Location::Location(std::string name,int x,int y,char ds)
    : _name(name), _x(x), _y(y),DS(ds)
{
    _monster_party = new Party();
}

Location::~Location()
{
    // This is causing some crashes.
    // Memory leaks are for kids anyway.
    //delete _monster_party;
}


NPC* Location::GetNPC()
{
    return &_npc;
}

void Location::OnArrival(Party* prty)
{
    cout << "You have arrived at " << _name << endl;
}

Town::Town(std::string name,int x,int y)
    : Location(name,x,y,'t')
{
}

Town::~Town() {}

AddTown::AddTown(std::string name,int x,int y)
    : Location(name,x,y)
{
    added_girl = false;
}

AddTown::~AddTown() {}

void AddTown::OnArrival(Party *prty)
{
    cout << "You have arrived at " << _name << endl;
    if(added_girl == 0)
    {
        cout << "There is a girl here, practicing magic.\n'My name is Arinoa,' she states. 'I am the one who rescued you.'";
        system("PAUSE");
        system("CLS");
        cout << "Suddenly, the door bursts open, and in crawl slimes and goblins!\nYou and Arinoa rush up to fight them...\n'I can handle this!' she cries, but you decide to help fight them anyway.\n\n";
        system("PAUSE");
        system("CLS");
        cout << "Arinoa has joined the party...\n";
        system("PAUSE");
        system("CLS");
        Hero arinoa;
        std::string girlname = "Arinoa";
        arinoa.setAll(girlname, 100, 100, 500, 500, 5, 10, 10, 90, 90, 400, 30);
        prty->addMember(arinoa);
        added_girl = 1;
        Monster goblin;
        goblin.setAll("Goblin", 30, 30, 0, 0, 2, 10, 10, 1, 1, 60, 80);
        Monster slime;
        slime.setAll("Slime", 20, 20, 0, 0, 5, 20, 1, 1, 40, 40);
        Party secondbattle(goblin);
        secondbattle.addMember(slime);
        secondbattle.addMember(slime);
        secondbattle.addMember(goblin);
        prty->attackParty(secondbattle);
        system("CLS");
        cout << "Liking the game so far?\nBuy the full version for just $9.99!\n";
        system("PAUSE");
        system("CLS");
        prty->setLocation(50,50);
    }
}
